﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Mvc;
using Kevin.Shop.Business.SalesManagement.Components;
using RiderShop.Mobile.Modle.MyAccount;
using RiderShop.Mobile.ServiceEntity.MyAccount;
using System.Web.Script.Serialization;
using RiderShop.Mobile.Common.Component;

namespace RiderShop.Mobile.Controllers.MyAccount
{
    public partial class MyAccountController : ThemeController
    {
        public JsonResult RegionList(string parentId)
        {
            int id = 0;
            if (!string.IsNullOrEmpty(parentId) && int.TryParse(parentId, out id))
            {
                List<RegionBasicInfo> regionList = new List<RegionBasicInfo>();
                regionList = MyAccountModel.GetRegionListByParentId(id);
                return Json(regionList, JsonRequestBehavior.AllowGet);
            }
            else
            {
                return Json("", JsonRequestBehavior.AllowGet);
            }
        }

        [Authorize]
        public ActionResult GetRegionById(int regionId)
        {
            var result = MyAccountModel.GetRegionByRegionId(regionId);
            return Content(result);
        }
    }
}
